import { createApp } from 'vue'
import Nprogress from 'nprogress'
import router from './routes/router'
import App from './App.vue'
import store from './store'
import Card from './components/Card'
import 'font-awesome/css/font-awesome.min.css'
import 'nprogress/nprogress.css'
import './main.less'

router.beforeEach(async (to, from) => {
  Nprogress.start()
  // // guard handle
  // if (!await canAccess(to.path)) {
  //     // explicitly return false to cancel the navigation
  //     return false
  // }
  Nprogress.inc(0.25)

  return true
})

router.afterEach((to, from) => {
  setTimeout(() => {
    Nprogress.done()
  }, 100)
})

const app = createApp(App)

app.use(router)
app.use(store)
app.use(Card)

app.mount('#app')
